#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>

int main(int argc, char *argv[])
{
    char *del_filename = "1.txt";
    if (access(del_filename, F_OK) != 0) {
        g_printf("access(%s) not found!\n", del_filename);
        return -1;
    }

    if (access(del_filename, W_OK) == 0) {
        if (!unlink(del_filename)) {
            g_printf("delete %s success\n", del_filename);
        } else {
            g_printf("delete %s faile\n", del_filename);
        }
    } else {
        g_printf("file can't write\n");
    }

        return 0;
    }
